home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / maxline.com / MAXLINES.C < prev   
Encoding:
C/C++ Source or Header  |  1989-02-11  |  3.1 KB  |  63 lines

  1. /*****************************************************************************\
  2. *                                                                             *
  3. * Programmer:     Eric E. Arneson   CIS 76701,76   GEnie MS.ASSTSYOP          *
  4. *                                                                             *
  5. * Date:           1988-12-16                                                  *
  6. *                                                                             *
  7. * Procedure Name: int _maxlines(void)    max lines of text on screen          *
  8. *                                                                             *
  9. * Discription:    switches text mode to the max number of lines on screen     *
  10. *                   on a 100% IBM EGA and EGA Display: 43 line mode           *
  11. *                   on a 100% IBM VGA and VGA Display: 50 line mode           *
  12. *                                                                             *
  13. *                 Freeware!                                                   *
  14. *                                                                             *
  15. \*****************************************************************************/
  16.  
  17. #include <dos.h>
  18.  
  19. #define CallVideoInt()   result = int86x(0x10,&inregs, &outregs, &segregs)
  20.  
  21. int maxlines(void);             /* this line should to be in any subprogram, */
  22.                                 /* making an "extern" call to _maxlines()    */
  23.  
  24. int _maxlines(void)
  25. {
  26.  union REGS inregs,outregs;
  27.  struct SREGS segregs;
  28.  int result;
  29.  
  30.  inregs.x.ax = 0x1200;          /* Get Config. Info. (Function 12h)          */
  31.  inregs.x.bx = 0xff10;          /* Get Config. Info. (SubFunction 10h)       */
  32.  inregs.h.cl = 0x0f;            /* Init. as a CGA 40x25 Secondary Adapter    */
  33.  CallVideoInt();
  34.  if(outregs.h.cl < 0x0c)        /* not set as a Secondary Adapter to an  MDA */
  35.    if(outregs.h.bh <= 0x01)     /* Type of Display                           */
  36.      if(outregs.h.bl <= 0x03) { /* Memory available on Adapter               */
  37.        inregs.x.ax = 0x0003;    /* Put into Co80                             */
  38.        CallVideoInt();
  39.        inregs.x.ax = 0x1112;    /* Load ROM 8 by 8 Font                      */
  40.        inregs.h.bl = 0x00;      /* and Reprogram Controller                  */
  41.        CallVideoInt();
  42.        inregs.x.ax = 0x0100;    /* Set Cursor Type                           */
  43.        inregs.x.cx = 0x0407;    /* Starting/Ending line for Cursor           */
  44.        CallVideoInt();
  45.        inregs.x.ax = 0x1200;    /* Select Alternate PrintScreen              */
  46.        inregs.x.bx = 0x0020;
  47.        CallVideoInt();
  48.        return(0);               /* return 0 that means it was successful     */
  49.       }
  50.  return(-1);                    /* return -1 that means it failed            */
  51. }
  52.  
  53. /******************************************\
  54. *                                          *
  55. * This main() is only here for making this *
  56. * a stand alone program.                   *
  57. *                                          *
  58. \******************************************/
  59. main()
  60. {
  61.  _maxlines();
  62. }
  63.